<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
@include('layouts.common.head')
<!-- Fonts -->
    <!-- Styles -->
    <link href="{{ asset('static/css/home/base.css') }}?v=<?php echo time() ?>" rel="stylesheet">
    <link href="{{asset('static/css/common.css')}}" rel="stylesheet" type="text/css">
    <link href="{{asset('static/css/resume.css')}}" rel="stylesheet" type="text/css">
</head>
<body>
<div id="app">
    @include('layouts.nav')
    @include('home.other_top_nav')
    <div class="new-search-box">
        <div class="ns-main">
            <div class="main-sty">
                <div class="sty-cell J_sli " data-type="full">全文
                    <div class="sty-aow"></div>
                </div>
                <div class="clear"></div>
            </div>
            <div class="main-sip">
                <div class="ip-group">
                    <form id="ajax_search_location" action="" method="get">
                        <div class="ip-box" style="width: 626px">
                            <input name="key" id="autoKeyInput" type="text" data-original=""
                                   value="{{\Illuminate\Support\Facades\Input::get('key')}}"
                                   placeholder="请输入职位名或简历名称"/>
                        </div>

                        {{--<div class="ip-city" data-toggle="funCityModal" data-title="请选择地区" data-multiple="false"--}}
                        {{--data-maximum="0" data-width="630">--}}

                        {{--</div>--}}
                        <div class="ip-btn"><input type="submit" class="sobut J_hoverbut" value="招人才"/></div>
                    </form>
                </div>

                <div class="clear"></div>
            </div>
        </div>
    </div>
    <!--搜索 -->
    <div class="so_condition J_so_condition">


        <div class="lefttit">工作经验</div>
        <div class="rs">
            <div class="li search-param @if(isSet($params['experience']) && $params['experience'] == 0) select @endif"
                 data-list="experience" data-code="0">不限
            </div>
            @foreach($category['_experience'] as $key=>$item)
                <div class="li search-param @if(isSet($params['experience']) && $params['experience'] == $key) select @endif "
                     data-list="experience" data-code="{{$key}}">{{$item}}</div>
            @endforeach
            <div class="clear"></div>
        </div>
        <div class="clear"></div>

        <div class="lefttit">学历</div>
        <div class="rs">
            <div class="li search-param @if(isSet($params['education']) && $params['education'] == 0) select @endif"
                 data-list="education" data-code="0">不限
            </div>
            @foreach($category['_education'] as $key=>$item)
                <div class="li search-param  @if(isSet($params['education']) && $params['education'] == $key) select @endif"
                     data-list="education" data-code="{{$key}}">{{$item}}</div>
            @endforeach
            <div class="clear"></div>
        </div>

        <div class="lefttit">更多筛选</div>
        <div class="rs">
            <div class="bli J_dropdown">
                <span class="txt">@if(isSet($params['sex']) && $params['sex'] == 1)
                        男 @elseif(isSet($params['sex']) && $params['sex']==2) 女 @else  性别 @endif </span>
                <div class="dropdowbox_noa J_dropdown_menu">
                    <div class="dropdow_inner_noa">
                        <ul class="nav_box">
                            <li class="search-param" data-list="sex" data-code="1">男</li>
                            <li class="search-param" data-list="sex" data-code="2">女</li>
                        </ul>
                    </div>
                </div>
                <div class="clear"></div>
            </div>

            <div class="bli J_dropdown">
                <span>@if(isSet($params['age']) && isSet($category['_age'][$params['age']])) {{$category['_age'][$params['age']]}}@else
                        年龄 @endif</span>
                <div class="dropdowbox_noa J_dropdown_menu">
                    <div class="dropdow_inner_noa">
                        <ul class="nav_box">
                            @foreach($category['_age'] as $key=>$item)
                                <li class="search-param" data-list="age" data-code="{{$key}}">{{$item}}</li>
                            @endforeach
                        </ul>
                    </div>
                </div>
                <div class="clear"></div>
            </div>
            <div class="bli J_dropdown">
                <span class="txt"
                      title="行业类别">@if(isSet($params['trade'])) {{$category['_trade'][$params['trade']]}}@else
                        行业类别 @endif</span>
                <div class="dropdowbox_searchtrade J_dropdown_menu">
                    <div class="dropdow_inner_searchtrade">
                        <ul class="nav_box">
                            @foreach($category['_trade'] as $key=>$item)
                                <li class="search-param" data-list="trade" data-code="{{$key}}"
                                    title="trade">{{$item}}</li>
                            @endforeach

                            <div class="clear"></div>
                        </ul>
                    </div>
                </div>
                <div class="clear"></div>
            </div>

            <div class="bli J_dropdown" style="width: 120px;padding-right: 25px;background-position: 136px -65px">
                <span class="txt">@if(isSet($params['wage']) && isSet($category['_wage'][$params['wage']])) {{$category['_wage'][$params['wage']]}}@else
                        期望薪资 @endif</span>

                <div class="dropdowbox_searchwage J_dropdown_menu">
                    <div class="dropdow_inner_searchwage">
                        <ul class="nav_box">
                            @foreach($category['_wage'] as $key=>$item)
                                <li class="search-param" data-list="wage" data-code="{{$key}}">{{$item}}</li>
                            @endforeach

                        </ul>
                    </div>
                </div>
                <div class="clear"></div>
            </div>
            <div class="bli J_dropdown">
                <span>
                     @if(isSet($params['time']))
                        @if($params['time'] ==3)
                            3天内
                        @elseif($params['time'] ==7)
                            7天内
                        @elseif($params['time'] ==15)
                            15天内
                        @elseif($params['time'] ==30)
                            30天内
                        @endif
                    @else
                        更新时间
                    @endif
                </span>
                <div class="dropdowbox_noa J_dropdown_menu">
                    <div class="dropdow_inner_noa">
                        <ul class="nav_box">
                            <li class="search-param" data-list="time" data-code="3">3天内</li>
                            <li class="search-param" data-list="time" data-code="7">7天内</li>
                            <li class="search-param" data-list="time" data-code="15">15天内</li>
                            <li class="search-param" data-list="time" data-code="30">30天内</li>
                        </ul>
                    </div>
                </div>
                <div class="clear"></div>
            </div>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>

        <!--已选条件，当没有条件的时候不显示下面的DIV -->
        @if(isSet($params['key']) || (isSet($params['experience']) && $params['experience']) || (isSet($params['education'])&& $params['education']) || isSet($params['sex']) || isSet($params['age']) || isSet($params['trade']) || isSet($params['wage']) || isSet($params['time']))
            <div class="selected J_selected" style="display: block">
                <div class="stit">已选条件</div>
                <div class="sc">
                    @if(isSet($params['key']))
                        <div class="slist" data-name="key">
                            <span>关键字：</span> {{$params['key']}}
                        </div>
                    @endif
                    @if(isSet($params['experience']) && isSet($category['_experience'][$params['experience']]))
                        <div class="slist" data-name="experience">
                            <span>工作经验：</span>
                            {{$category['_experience'][$params['experience']]}}
                        </div>
                    @endif
                    @if(isSet($params['education']) && isSet($category['_education'][$params['education']]))
                        <div class="slist" data-name="education">
                            <span>学历：</span>
                            {{$category['_education'][$params['education']]}}
                        </div>
                    @endif
                    @if(isSet($params['sex']))
                        <div class="slist" data-name="sex">
                            <span>性别：</span>
                            @if($params['sex'] == 1)男
                            @elseif($params['sex'] == 2)
                                女
                            @endif
                        </div>
                    @endif
                    @if(isSet($params['age']) && isSet($category['_age'][$params['age']]))
                        <div class="slist" data-name="age">
                            <span>年龄：</span>
                            {{$category['_age'][$params['age']]}}
                        </div>
                    @endif
                    @if(isSet($params['trade']) && isSet($category['_trade'][$params['trade']]))
                        <div class="slist" data-name="trade">
                            <span>职位分类：</span>
                            {{$category['_trade'][$params['trade']]}}
                        </div>
                    @endif
                    @if(isSet($params['wage'])  && isSet($category['_wage'][$params['wage']]) )
                        <div class="slist" data-name="wage">
                            <span>期望薪资：</span>
                            {{$category['_wage'][$params['wage']]}}
                        </div>
                    @endif
                    @if(isSet($params['time']))
                        <div class="slist" data-name="time">
                            <span>更新时间：</span>
                            {{$params['time']}}天之内
                        </div>
                    @endif

                    <div class="clear"></div>
                </div>
                <div class="sr">
                    <div class="empty" onclick="window.location='{{url('resume')}}';">清空</div>
                </div>
                <div class="clear"></div>
            </div>
        @endif
    </div>

    <div class="plist">
        <div class="pl" style="overflow: hidden;min-height: 500px">
            <div class="toptitle">
                <div class="ltype">
                    <div class="typeli search-param @if(isSet($params['sort']) && $params['sort'] == 1) select @endif"
                         data-list="sort" data-code="1">综合排序
                    </div>
                    <div class="typeli search-param @if(isSet($params['sort']) && $params['sort'] == 2) select @endif"
                         data-list="sort" data-code="2">更新时间
                    </div>
                    <div class="clear search-param"></div>
                </div>
                <div class="ts">
                    <div class="l1 ">
                    </div>
                    <div class="l2 ">
                        <div class="radiotxt"></div>
                        <div class="clear"></div>
                    </div>
                    <div class="clear"></div>
                </div>
            </div>
            <div class="listb J_allListBox">
                @if($resume->total())
                    @foreach($resume as $item)
                        <div class="J_resumeList yli" data-rid="">
                            <div class="td1">

                            </div>

                            <div class="td2 link_blue substring link_visited">
                                <a href="{{url('resume/info',[$item->id])}}" target="_blank">{{$item->nickname}}</a>
                            </div>
                            <div class="td4">
                                <div class="txt font_gray6">

                                </div>
                            </div>
                            <div class="td1">

                            </div>
                            <div class="clear"></div>
                            <div class="detail">
                                <div class="ltx">
                                    <div class="photo"></div>
                                    <div class="tcent">
                                        <div class="txt font_gray6">
                                            {{($item->sex ==1)?'男':'女'}}
                                            <span>|</span>{{str_replace("+",',',$item->intention_cn)}}
                                            <span>|</span>{{$item->wage_cn}}<span>|</span>{{$item->education_cn}}
                                        </div>
                                        <div class="dlabs">
                                            {{$item->specialty}}
                                            <div class="clear"></div>
                                        </div>
                                    </div>
                                    <div class="clear"></div>
                                </div>
                                <div class="rbtn">
                                    <div class="deliver J_downResume"
                                         data-url="{{url('resume/doc',[$item->id])}}">下载简历
                                    </div>
                                    {{--<div class="favorites J_collectForResume" data-batch="false"--}}
                                    {{--data-url="{:U('AjaxCompany/resume_favor')}">收藏--}}
                                    {{--</div>--}}
                                </div>
                                <div class="clear"></div>
                            </div>
                        </div>
                    @endforeach
                @else
                    <div class="list_empty_group">
                        <div class="list_empty">
                            <div class="list_empty_left"></div>
                            <div class="list_empty_right">
                                <div class="sorry_box">对不起，没有找到符合您条件的简历！</div>
                                <div class="stips_box">放宽您的查找条件也许有更多合适您的简历哦~</div>
                            </div>
                            <div class="clear"></div>
                        </div>
                    </div>
                @endif
            </div>

        </div>
        <div class="clear"></div>
    </div>
</div>
@include('layouts.common.foot')
<script type="text/javascript" src="{{asset('static/js/jquery.autocomplete.js')}}"></script>
<script type="text/javascript" src="{{asset('static/js/jquery.dropdown.js')}}"></script>
<script>
    // $('li').click(function () {
    //     var down = $(this).data('url');
    //     window.location.href = down;
    // })
    // let url = window.location.search;

    function changeURLArg(url, arg, arg_val) {
        let pattern = arg + '=([^&]*)';
        let replaceText = arg + '=' + arg_val;
        if (url.match(pattern)) {
            let tmp = '/(' + arg + '=)([^&]*)/gi';
            tmp = url.replace(eval(tmp), replaceText);
            return tmp;
        } else {
            if (url.match('[\?]')) {
                return url + '&' + replaceText;
            } else {
                return url + '?' + replaceText;
            }
        }
    }

    $('.search-param').click(function () {
        let arg = $(this).data('list');
        let arg_val = $(this).data('code');
        let url = changeURLArg(window.location.href, arg, arg_val);
        window.location.href = url;
    });

    function changeURLArg(url, arg, arg_val) {
        let pattern = arg + '=([^&]*)';
        let replaceText = arg + '=' + arg_val;
        if (url.match(pattern)) {
            let tmp = '/(' + arg + '=)([^&]*)/gi';
            tmp = url.replace(eval(tmp), replaceText);
            return tmp;
        } else {
            if (url.match('[\?]')) {
                return url + '&' + replaceText;
            } else {
                return url + '?' + replaceText;
            }
        }
    }

    function funcUrlDel(name) {
        var loca = window.location;
        var baseUrl = loca.origin + loca.pathname + "?";
        var query = loca.search.substr(1);
        if (query.indexOf(name) > -1) {
            var obj = {};
            var arr = query.split("&");
            for (var i = 0; i < arr.length; i++) {
                arr[i] = arr[i].split("=");
                obj[arr[i][0]] = arr[i][1];
            }
            delete obj[name];
            var url = baseUrl + JSON.stringify(obj).replace(/[\"\{\}]/g, "").replace(/\:/g, "=").replace(/\,/g, "&");
            return url
        }
        ;
    }

    $('.slist').click(function () {
        var name = $(this).data('name');
        window.location.href = funcUrlDel(name)

    });

    $('.J_downResume').click(function () {
        var url = $(this).data('url');
        $.ajax({
            url: '{{url('validate/company')}}',
            type: 'post',
            dataType: 'json',
            success: function (r) {
                if (r.error == 0) {
                    disapperTooltip('remind', "下载简历中，请稍后。。。");
                    window.location.href = url;
                } else {
                    disapperTooltip('remind', r.msg);
                }
            }
        });
    })
</script>
@include('layouts.register')
</body>
</html>